<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>
        <p:dialog id="AlertsEditDlg" widgetVar="AlertsEditDialog" modal="true" resizable="false"  appendTo="@(body)" header="#{myBundle.EditAlertsTitle}" closeOnEscape="true">

            <h:form id="AlertsEditForm">

                <h:panelGroup id="display">
                    <p:panelGrid  columns="2" columnClasses="column" rendered="#{historyController.selected != null}">

                        <p:outputLabel value="#{myBundle.EditAlertsLabel_simpleModel}" for="simpleModel" />
                        <p:inputText id="simpleModel" value="#{historyController.selected.simpleModel}" title="#{myBundle.EditAlertsTitle_simpleModel}"/>

                        <h:outputLabel value="#{myBundle.EditAlertsLabel_id}" for="id" />
                        <h:outputText id="id" value="#{historyController.selected.id}" />

                        <p:outputLabel value="#{myBundle.EditAlertsLabel_type}" for="type" />
                        <p:inputText id="type" value="#{historyController.selected.type}" title="#{myBundle.EditAlertsTitle_type}" required="true" requiredMessage="#{myBundle.EditAlertsRequiredMessage_type}" size="20" maxlength="20"/>

                        <p:outputLabel value="#{myBundle.EditAlertsLabel_latitude}" for="latitude" />
                        <p:inputText id="latitude" value="#{historyController.selected.latitude}" title="#{myBundle.EditAlertsTitle_latitude}" required="true" requiredMessage="#{myBundle.EditAlertsRequiredMessage_latitude}"/>

                        <p:outputLabel value="#{myBundle.EditAlertsLabel_longitude}" for="longitude" />
                        <p:inputText id="longitude" value="#{historyController.selected.longitude}" title="#{myBundle.EditAlertsTitle_longitude}" required="true" requiredMessage="#{myBundle.EditAlertsRequiredMessage_longitude}"/>

                        <p:outputLabel value="#{myBundle.EditAlertsLabel_description}" for="description" />
                        <p:inputText id="description" value="#{historyController.selected.description}" title="#{myBundle.EditAlertsTitle_description}" size="250" maxlength="250"/>

                        <p:outputLabel value="#{myBundle.EditAlertsLabel_phone}" for="phone" />
                        <p:inputText id="phone" value="#{historyController.selected.phone}" title="#{myBundle.EditAlertsTitle_phone}" required="true" requiredMessage="#{myBundle.EditAlertsRequiredMessage_phone}"/>

                        <p:outputLabel value="#{myBundle.EditAlertsLabel_name}" for="name" />
                        <p:inputText id="name" value="#{historyController.selected.name}" title="#{myBundle.EditAlertsTitle_name}" required="true" requiredMessage="#{myBundle.EditAlertsRequiredMessage_name}" size="25" maxlength="25"/>

                        <p:outputLabel value="#{myBundle.EditAlertsLabel_date}" for="date" />
                        <p:calendar id="date" pattern="MM/dd/yyyy HH:mm:ss" value="#{historyController.selected.date}" title="#{myBundle.EditAlertsTitle_date}" required="true" requiredMessage="#{myBundle.EditAlertsRequiredMessage_date}" showOn="button"/>

                        <p:outputLabel value="#{myBundle.EditAlertsLabel_user}" for="user" />
                        <p:selectOneMenu id="user" value="#{historyController.selected.user}"  converter="usersConverter">
                            <f:selectItem itemLabel="#{myBundle.SelectOneMessage}"/>
                            <f:selectItems value="#{usersController.items}"
                                           var="userItem"
                                           itemValue="#{userItem}"
                                           itemLabel="#{userItem.user.toString()}"
                                           />

                        </p:selectOneMenu>
                    </p:panelGrid>

                    <p:commandButton actionListener="#{historyController.save}" value="#{myBundle.Save}" update="display,:AlertsListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,AlertsEditDialog);">
                        <p:confirm header="#{myBundle.ConfirmationHeader}" message="#{myBundle.ConfirmEditMessage}" icon="ui-icon-alert"/>
                    </p:commandButton>

                    <p:commandButton value="#{myBundle.Cancel}" onclick="AlertsEditDialog.hide()"/>

                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
